package com.systemsetup.systemsetup.web.web;

import cn.hutool.json.JSONObject;
import com.systemsetup.systemsetup.support.annotaion.Action;
import com.systemsetup.systemsetup.support.annotaion.At;
import com.systemsetup.systemsetup.support.model.RespEntity;
import com.systemsetup.systemsetup.web.service.DepartmentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Action
@RequestMapping(value="department")
public class DepartmentController {
    @Resource
    public DepartmentService departmentService;

    /**
     * 部门树形菜单
     * @param
     * @return
     */
    @At(value = "departmentTree", method = RequestMethod.GET)
    public RespEntity departmentTree(@RequestBody(required = false) JSONObject jsonParam){

        return departmentService.departmentTree(jsonParam);
    }

    /**
     * 部门添加
     * @param
     * @return
     */
    @At(value = "departmentAdd", method = RequestMethod.POST)
    public RespEntity departmentAdd(@RequestBody(required = false) JSONObject jsonParam){

        return departmentService.departmentAdd(jsonParam);
    }

    /**
     * 部门修改
     * @param
     * @return
     */
    @At(value = "departmentUpdate", method = RequestMethod.POST)
    public RespEntity departmentUpdate(@RequestBody(required = false) JSONObject jsonParam){

        return departmentService.departmentUpdate(jsonParam);
    }

    /**
     * 部门删除
     * @param
     * @return
     */
    @At(value = "departmentDelete", method = RequestMethod.POST)
    public RespEntity departmentDelete(@RequestBody(required = false) JSONObject jsonParam){

        return departmentService.departmentDelete(jsonParam);
    }

    /**
     * 部门详情
     * @param
     * @return
     */
    @At(value = "departmentDetail", method = RequestMethod.GET)
    public RespEntity departmentDetail(@RequestBody(required = false) JSONObject jsonParam){

        return departmentService.departmentDetail(jsonParam);
    }
}
